Page({
  data: {
    difficulty: 'easy' // 默认简单难度
  },

  onLoad() {
    // 页面加载时获取本地存储的难度设置
    const savedDifficulty = wx.getStorageSync('difficulty');
    if (savedDifficulty) {
      this.setData({
        difficulty: savedDifficulty
      });
    }
  },

  // 设置游戏难度
  setDifficulty(e) {
    const level = e.currentTarget.dataset.level;
    this.setData({
      difficulty: level
    });
    // 保存难度设置到本地存储
    wx.setStorageSync('difficulty', level);
  },

  // 开始游戏
  startGame() {
    wx.navigateTo({
      url: '/pages/courses/tcs/game/game'
    });
  }
});
    